package com.knowif.backend.service;

import com.knowif.pojo.Banner;
import com.knowif.pojo.BannerExample;
import com.knowif.service.Banner_service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Xh
 * @date ：Created in 2019/5/6 0006 20:38
 */
@Service
public class BannerService {

    @Autowired
    private Banner_service banner_service;

    /**
     * 条件查询banner
     * @param bannerExample
     * @return
     */
    public List<Banner> selectBanner(BannerExample bannerExample){
        return banner_service.selectBanner(bannerExample);
    }

    /**
     * 保存banner
     * @return
     */
    public boolean saveBanner(Banner banner){
        int i = banner_service.saveBanner(banner);
        if(i == 0){
            return false;
        }
        return true;
    }

    /**
     * 保存banner
     * @return
     */
    public boolean updateBannerNotNull(Banner banner){
        int i = banner_service.updateBannerNotNull(banner);
        if(i == 0){
            return false;
        }
        return true;
    }

    /**
     * 保存banner
     * @return
     */
    public boolean updateBanner(Banner banner){
        int i = banner_service.updateBanner(banner);
        if(i == 0){
            return false;
        }
        return true;
    }

    /**
     * 删除banner
     * @return
     */
    public boolean deleteBanner(int bannerId){
        int i = banner_service.deleteBanner(bannerId);
        if(i == 0){
            return false;
        }
        return true;
    }

}
